package com.onairm.baselibrary.utils;

/**
 * Created by bqy on 2018/3/26.
 */

public class SharePrefer {

    /**
     * 退出登陆
     */
    public static void logout() {
        SpUtil.putPreference("loginStatus", false);
        SpUtil.delete("userInfo");
    }

    /**
     * 登陆
     */
    public static void login() {
        SpUtil.putPreference("loginStatus", true);
    }

    /**
     * 判断是否登陆
     *
     * @return
     */
    public static boolean isLogined() {
        return SpUtil.getBooleanPreference("loginStatus");
    }

    /**
     * 保存userId
     *
     * @param userId
     */
    public static void saveUserId(String userId) {
        SpUtil.putPreference("userId", userId);
    }

    /**
     * 获取userId
     *
     * @return
     */
    public static String getUserId() {
        return SpUtil.getStringPreference("userId", "");
    }

    /**
     * 获取token
     *
     * @return
     */
    public static String getToken() {
        return SpUtil.getStringPreference("token", "");
    }

    /**
     * 保存token
     *
     * @param token
     */
    public static void saveToken(String token) {
        SpUtil.putPreference("token", token);
    }

    /**
     * 获取七牛host
     *
     * @return
     */
    public static String getQiniuHost() {
        return SpUtil.getStringPreference("qiniuHost", "");
    }

    /**
     * 保存七牛host
     *
     * @param qiniuHost
     */
    public static void saveQiniuHost(String qiniuHost) {
        SpUtil.putPreference("qiniuHost", qiniuHost);
    }

}
